home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / helpbrowser.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-10-16  |  6.0 KB  |  187 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8. *   Copyright (C) 2004 by Craig Bradney                                   *
  9. *   cbradney@zip.com.au                                                   *
  10. *   Copyright (C) 2005 by Petr Vanek                                      *
  11. *   petr@yarpen.cz                                                        *
  12. *                                                                         *
  13. *   This program is free software; you can redistribute it and/or modify  *
  14. *   it under the terms of the GNU General Public License as published by  *
  15. *   the Free Software Foundation; either version 2 of the License, or     *
  16. *   (at your option) any later version.                                   *
  17. *                                                                         *
  18. *   This program is distributed in the hope that it will be useful,       *
  19. *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  20. *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  21. *   GNU General Public License for more details.                          *
  22. *                                                                         *
  23. *   You should have received a copy of the GNU General Public License     *
  24. *   along with this program; if not, write to the                         *
  25. *   Free Software Foundation, Inc.,                                       *
  26. *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  27. ***************************************************************************/
  28.  
  29. #ifndef HELPBROWSER_H
  30. #define HELPBROWSER_H
  31.  
  32. #include <QAction>
  33. #include <QItemSelection>
  34. #include <QList>
  35. #include <QMainWindow>
  36. #include <QMenu>
  37. #include <QMenuBar>
  38. #include <QPair>
  39. #include <QString>
  40. #include <QToolBar>
  41. #include <QUrl>
  42. #include <QVariant>
  43. #include <QWidget>
  44.  
  45. class QEvent;
  46.  
  47. #include "ui_helpbrowser.h"
  48. #include "scribusapi.h"
  49. #include "util.h"
  50. #include "scconfig.h"
  51. #include "scpaths.h"
  52. #include "prefsmanager.h"
  53. #include "prefsfile.h"
  54. #include "schelptreemodel.h"
  55.  
  56. //! \brief A structure holding title/file url reference.
  57. struct histd2 {
  58.     QString url;
  59.     QString title;
  60. };
  61.  
  62. class SCRIBUS_API HelpBrowser : public QMainWindow, Ui::HelpBrowser
  63. {
  64.     Q_OBJECT
  65.  
  66. public:
  67.     HelpBrowser(QWidget* parent);
  68.     HelpBrowser(QWidget* parent, const QString& caption, const QString& guiLangage="en", const QString& jumpToSection="", const QString& jumpToFile="");
  69.     ~HelpBrowser();
  70.     
  71.     
  72.     virtual void changeEvent(QEvent *e);
  73.  
  74.     /*! \brief History menu. It's public because of history reader - separate class */
  75.     QMenu* histMenu;
  76.     /*! \brief Mapping the documents for history. */
  77.     QMap<QAction*, histd2> mHistory;
  78.     /*! \brief Set text to the browser
  79.     \param str a QString with text (html) */
  80.     void setText(const QString& str);
  81.     
  82.     static bool firstRun;
  83.  
  84. protected:
  85.     void closeEvent(QCloseEvent * event);
  86.  
  87.     void setupLocalUI();
  88.     /*! \brief Reads saved bookmarks from external file */
  89.     void readBookmarks();
  90.     /*! \brief Search in doc files in spec. dir.
  91.     It uses directory-recursion. I hope that the documentation will have
  92.     only 2-3 level dir structure so it doesn't matter.
  93.     \author Petr Vanek <petr@yarpen.cz> */
  94.     void searchingInDirectory(const QString&);
  95.  
  96.     /*! \brief Reads saved history of browsing. */
  97.     void readHistory();
  98.  
  99.     /*! \brief Tell the user there is no help available */
  100.     void displayNoHelp();
  101.     
  102.     QMenu* fileMenu;
  103.     QMenu* editMenu;
  104.     QMenu* bookMenu;
  105.     QAction* filePrint;
  106.     QAction* fileExit;
  107.     QAction* editFind;
  108.     QAction* editFindNext;
  109.     QAction* editFindPrev;
  110.     QAction* bookAdd;
  111.     QAction* bookDel;
  112.     QAction* bookDelAll;
  113.     QAction* goHome;
  114.     QAction* goBack;
  115.     QAction* goFwd;
  116.  
  117.     //! \brief Selected language is here. If there is no docs for this language, "en" is used.
  118.     QString language;
  119.     //! \brief QString holding location of menu.xml we are using, we load the help files from here
  120.     QString finalBaseDir;
  121.     /*! \brief Text to be found in document */
  122.     QString findText;
  123.     /** \brief Configuration structure */
  124.     PrefsContext* prefs;
  125.     ScHelpTreeModel* menuModel;
  126.     QMap<QString, QString> quickHelpIndex;
  127.     QMap<QString, QPair<QString, QString> > bookmarkIndex;
  128.     
  129. protected slots:
  130.     virtual void languageChange();
  131.     void histChosen(QAction* i);
  132.     void jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile="");
  133.     void loadHelp(const QString& filename);
  134.     void loadMenu();
  135.     void showLinkContents(const QString &link);
  136.     QString bookmarkFile();
  137.     QString historyFile();
  138.  
  139.     /*! \brief Load doc file when user select filename in content view. */
  140.     void itemSelected(const QItemSelection & selected, const QItemSelection & deselected);
  141.  
  142.     /*! \brief Load doc file when user select filename in search view. */
  143.     void itemSearchSelected(QTreeWidgetItem *, int);
  144.  
  145.     /*! \brief Load doc file when user select filename in bookmark view. */
  146.     void itemBookmarkSelected(QTreeWidgetItem *, int);
  147.  
  148.     /*! \brief Performs searching in documentation.
  149.     It walks through installed documentation and searching in all text files
  150.     \author Petr Vanek <petr@yarpen.cz> */
  151.     void searchingButton_clicked();
  152.  
  153.     /*! \brief Find text in one document.
  154.     Classical ctrl+f searching.
  155.     \author Petr Vanek <petr@yarpen.cz> */
  156.     void find();
  157.  
  158.     /*! \brief Find next occurences of the text in one document.
  159.     \author Petr Vanek <petr@yarpen.cz> */
  160.     void findNext();
  161.  
  162.     /*! \brief Find previous occurences of the text in one document.
  163.     \author Petr Vanek <petr@yarpen.cz> */
  164.     void findPrevious();
  165.  
  166.     /*! \brief Print the documentation.
  167.     Based on the Qt example.
  168.     */
  169.     void print();
  170.  
  171.     /*! \brief Add document into bookmarks. */
  172.     void bookmarkButton_clicked();
  173.  
  174.     /*! \brief Delete selected document from bookmarks. */
  175.     void deleteBookmarkButton_clicked();
  176.  
  177.     /*! \brief Delete all bookmarks */
  178.     void deleteAllBookmarkButton_clicked();
  179.  
  180. signals:
  181.     void closed();
  182.  
  183. };
  184.  
  185. #endif // HELPBROWSER_H
  186.  
  187.